<template>
  <div>
    <router-view />
    <van-tabbar v-model="active" active-color="#ff7700" @change="onChange" route class="tabbar-topBoder">
      <van-tabbar-item icon="home-o" to="/home">
        首页
        <template #icon="props">
          <i class="mobile-font icon-home" style="font-size:20px;" :style="{color:props.active ? '#ff7700' : '#646566'}"></i>
        </template>
      </van-tabbar-item>
      <van-tabbar-item icon="search" to="/message">
        消息
        <template #icon="props">
          <i class="mobile-font icon-message" style="font-size:20px;" :style="{color:props.active ? '#ff7700' : '#646566'}"></i>
        </template>
      </van-tabbar-item>
      <van-tabbar-item icon="setting-o" to="/my">
        我的
        <template #icon="props">
          <i class="mobile-font icon-me" style="font-size:20px;" :style="{color:props.active ? '#ff7700' : '#646566'}"></i>
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import homeIcon from '@/assets/tabbar/home.png'
import homeActiveIcon from '@/assets/tabbar/home2x.png'
import messageIcon from '@/assets/tabbar/message.png'
import messageActiveIcon from '@/assets/tabbar/message2x.png'
import addressBookIcon from '@/assets/tabbar/addressBook.png'
import addressBookActiveIcon from '@/assets/tabbar/addressBook2x.png'
import myIcon from '@/assets/tabbar/my.png'
import myActiveIcon from '@/assets/tabbar/my2x.png'
export default {
  name: 'tabbar',
  data() {
    return {
      active: 0,
      homeIcon: homeIcon,
      homeActiveIcon: homeActiveIcon,
      messageIcon: messageIcon,
      messageActiveIcon: messageActiveIcon,
      addressBookIcon: addressBookIcon,
      addressBookActiveIcon: addressBookActiveIcon,
      myIcon: myIcon,
      myActiveIcon: myActiveIcon
    }
  },
  methods: {
    onChange (index) {
      console.log(index)
    }
  }
}
</script>

<style scoped>
.tabbar-topBoder{
  border-top: 1px solid #E8E8E8;
}
</style>
